#ifndef QWIDGETFACTORY_H
#define QWIDGETFACTORY_H

#include "corelibglobal.h"
#include <QMetaObject>
#include <QMap>
#include <QString>
#include <QWidget>
#include "tagwidget.h"
class QAbstractHost;
class XMLObject;

struct TagWidgetInfo {
    const QMetaObject *m_hostObject;
    QString m_name;
    QString m_svgCode;
};

class CORELIB_EXPORT QWidgetFactory
{
protected:
    QWidgetFactory();

public:
    static void registerWidget(QString name, QString svgCode, const QMetaObject *host);
    static TagWidget* createWidget(const QString& name);
    static QMap<QString, TagWidgetInfo*> getWidgetInfo();
    static TagWidget* createWidget(XMLObject* xml);
    static TagWidgetInfo* getWidgetInfo(const QString &name);

protected:
    static QMap<QString, TagWidgetInfo*> m_metaMap;
};

#endif // QWIDGETFACTORY_H
